#pragma once


class KRasterizerStateD3D9 : public VRRasterizerState, public VAllocator//, public VRefTarget
{
	virtual void Release() 
	{
		VRefTarget::Release();
	}
	virtual void DeleteThis();
public:
	inline KRasterizerStateD3D9(const VRRasterizerStateDesc& _StateDesc):m_StateDesc(_StateDesc)
	{

	}

	D3DFILLMODE FillMode;
	D3DCULL CullMode;
	float DepthBias;
	float SlopeScaleDepthBias;
	BOOL AllowMSAA;
	VRRasterizerStateDesc m_StateDesc;
};

class KSamplerStateD3D9 : public VRSamplerState, public VAllocator//, public VRefTarget
{
	virtual void Release() { VRefTarget::Release(); }
	virtual void DeleteThis();
	virtual EVRSamplerFilter GetFilter() const  { return VRSF_POINT;}
	virtual EVRSamplerAddressMode GetAddressU() const { return VRSAM_CLAMP;}
public:
	inline KSamplerStateD3D9(const VRSamplerStateDesc& StateDesc):m_StateDesc(StateDesc){}
	D3DTEXTUREFILTERTYPE MagFilter;
	D3DTEXTUREFILTERTYPE MinFilter;
	D3DTEXTUREFILTERTYPE MipFilter;
	D3DTEXTUREADDRESS AddressU;
	D3DTEXTUREADDRESS AddressV;
	D3DTEXTUREADDRESS AddressW;
	INT MipMapLODBias;
	DWORD BorderColor;
	VRSamplerStateDesc m_StateDesc;
};

class KDepthStencilStateD3D9 : public VRDepthStencilState,public VAllocator//, public VRefTarget
{
	virtual void Release() { VRefTarget::Release(); }
	virtual void DeleteThis();
public:
	inline KDepthStencilStateD3D9(const VRDepthStencilStateDesc& StateDesc):m_StateDesc(StateDesc)
	{
	}

	BOOL ZEnable;
	BOOL ZWriteEnable;
	D3DCMPFUNC ZFunc;

	BOOL StencilEnable;
	BOOL TwoSidedStencilMode;
	D3DCMPFUNC StencilFunc;
	D3DSTENCILOP StencilFail;
	D3DSTENCILOP StencilZFail;
	D3DSTENCILOP StencilPass;
	D3DCMPFUNC CCWStencilFunc;
	D3DSTENCILOP CCWStencilFail;
	D3DSTENCILOP CCWStencilZFail;
	D3DSTENCILOP CCWStencilPass;
	DWORD StencilReadMask;
	DWORD StencilWriteMask;
	DWORD StencilRef;

	VRDepthStencilStateDesc m_StateDesc;
};

class KBlendStateD3D9 : public VRBlendState,public VAllocator//, public VRefTarget
{
	virtual void Release() { VRefTarget::Release(); }
	virtual void DeleteThis();
public:
	inline KBlendStateD3D9(const VRBlendStateDesc& StateDesc):m_StateDesc(StateDesc)
	{
	}

	BOOL AlphaBlendEnable;
	D3DBLENDOP ColorBlendOp;
	D3DBLEND ColorSrcFactor;
	D3DBLEND ColorDestFactor;

	BOOL bSeparateAlphaBlendEnable;
	D3DBLENDOP AlphaBlendOp;
	D3DBLEND AlphaSrcFactor;
	D3DBLEND AlphaDestFactor;

	BOOL bAlphaTestEnable;
	D3DCMPFUNC AlphaFunc;
	DWORD AlphaRef;
	
	DWORD BlendFactor;

	VRBlendStateDesc m_StateDesc;
};
